<!--
author:        leishanfeng <1628316216@qq.com>
date:          2023-07-05 19:49:40
component:     index
Copyright © YourCompanyName All rights reserved
-->
<template>
  <div class="bigBox">
    <borderomponent>
      <!-- <Map></Map> -->
      <!-- <template v-slot:content> -->
      <dialogXinzengchengyuan
        :isdialogVisibleNew="isDialogVisible"
        @jianting="jianting"
        :department="department"
        @name="getName"
      ></dialogXinzengchengyuan>
      <selectPersonPopup
        @getHeadName="getHeadName"
        @addMembers="addMembers"
        @close="clsoe"
        :isOuterVisible="isOuterVisible"
      ></selectPersonPopup>
      <div class="bigBox-box">
        <div class="bigBox-box-tab">
          <el-form :model="numberValidateForm" ref="numberValidateForm">
            <div class="newBox-title" style="margin-bottom: 15px">
              {{ numberValidateForm?.protectName }}
            </div>
            <div class="new-List-box">
              <div class="new-List-box-title">防护目标类型</div>
              <div class="new-List-box-name" style="width: 1650px">
                {{ numberValidateForm.protectType }}
              </div>
            </div>
            <div class="new-List-box">
              <div class="new-List-box-title">
                <div style="color: #ff6a6b; font-size: 16px; font-family: MicrosoftYaHei">
                  *
                </div>
                社会统一信用代码
              </div>
              <div class="new-List-box-name">
                <el-form-item
                  label=""
                  prop="cid"
                  :rules="[
                    {
                      required: true,
                      message: '社会统一信用代码',
                      trigger: 'blur',
                    },
                    {
                      min: 18,
                      max: 18,
                      message: '请输入18位社会统一信用代码',
                      trigger: 'blur',
                    },
                  ]"
                >
                  <el-input
                    style="width: 380px"
                    placeholder="请输入社会统一信用代码"
                    v-model="numberValidateForm.cid"
                    oninput="if(value.length>18){value=value.slice(0,18)}"
                    v-if="isEdit"
                  ></el-input>
                  <div v-if="!isEdit">
                    {{ numberValidateForm?.cid }}
                  </div>
                </el-form-item>
              </div>
              <div class="new-List-box-title">
                <div style="color: #ff6a6b; font-size: 16px; font-family: MicrosoftYaHei">
                  *
                </div>
                地址
              </div>
              <div class="new-List-box-name">
                <el-form-item
                  label=""
                  prop="address"
                  hide-required-asterisk="true"
                  :rules="[
                    {
                      required: true,
                      message: '请输入地址',
                      trigger: 'blur',
                    },
                  ]"
                  style="text-align: right"
                >
                  <el-input
                    v-if="isEdit"
                    style="width: 380px"
                    placeholder="请输入地址"
                    v-model="numberValidateForm.address"
                  ></el-input>
                  <div v-else>{{ numberValidateForm.address }}</div>
                </el-form-item>
              </div>
              <div class="new-List-box-title">
                <div style="color: #ff6a6b; font-size: 16px; font-family: MicrosoftYaHei">
                  *
                </div>
                经纬度
              </div>
              <div class="new-List-box-name">
                <el-form-item
                  hide-required-asterisk="true"
                  :rules="{
                    message: '请选择经纬度',
                    trigger: 'blur',
                  }"
                  label=""
                  prop="address"
                >
                  <NewMap
                    v-if="isEdit"
                    style="width: 380px"
                    @childByValue="childValue"
                    @getAddress="getAddress"
                    :Newaddress="Newaddress"
                  ></NewMap>
                  <div v-else>
                    经度：{{ numberValidateForm?.coordinateY?.toFixed(8) }}纬度：{{
                      numberValidateForm?.coordinateX?.toFixed(8)
                    }}
                  </div>
                </el-form-item>
              </div>
            </div>
            <div class="new-List-box">
              <div class="new-List-box-title">
                <div style="color: #ff6a6b; font-size: 16px; font-family: MicrosoftYaHei">
                  *
                </div>
                安全生产第一责任人
              </div>
              <div class="new-List-box-name">
                <el-form-item
                  hide-required-asterisk="true"
                  :rules="{
                    required: true,
                    message: '请输入安全生产第一责任人姓名不能为空',
                    trigger: 'blur',
                  }"
                  label=""
                  prop="firstHead"
                >
                  <el-input
                    style="width: 380px"
                    placeholder="请输入安全生产第一责任人姓名"
                    v-model="numberValidateForm.firstHead"
                    v-if="isEdit"
                  >
                  </el-input>
                  <div v-else>
                    {{ numberValidateForm.firstHead }}
                  </div>
                </el-form-item>
              </div>
              <div class="new-List-box-title">
                <div style="color: #ff6a6b; font-size: 16px; font-family: MicrosoftYaHei">
                  *
                </div>
                职务
              </div>
              <div class="new-List-box-name">
                <el-form-item
                  hide-required-asterisk="true"
                  :rules="[
                    {
                      required: true,
                      message: '请输入负责人职务',
                      trigger: 'blur',
                    },
                  ]"
                  label=""
                  prop="firstJob"
                >
                  <el-input
                    v-if="isEdit"
                    style="width: 380px"
                    placeholder="请输入负责人职务"
                    v-model="numberValidateForm.firstJob"
                  ></el-input>
                  <div v-else>
                    {{ numberValidateForm.firstJob }}
                  </div>
                </el-form-item>
              </div>
              <div class="new-List-box-title">
                <div style="color: #ff6a6b; font-size: 16px; font-family: MicrosoftYaHei">
                  *
                </div>
                负责人电话
              </div>
              <div class="new-List-box-name">
                <el-form-item
                  hide-required-asterisk="true"
                  :rules="[
                    {
                      required: true,
                      message: '负责人电话',
                      trigger: 'blur',
                    },
                    {
                      min: 11,
                      max: 11,
                      message: '请输入11位手机号',
                      trigger: 'blur',
                    },
                  ]"
                  label=""
                  prop="firstHeadPhone"
                >
                  <el-input
                    v-if="isEdit"
                    style="width: 380px"
                    placeholder="请输入负责人电话"
                    v-model="numberValidateForm.firstHeadPhone"
                  ></el-input>
                  <div v-else>
                    {{ numberValidateForm.firstHeadPhone }}
                  </div>
                </el-form-item>
              </div>
            </div>
            <div class="new-List-box">
              <div class="new-List-box-title">
                <div style="color: #ff6a6b; font-size: 16px; font-family: MicrosoftYaHei">
                  *
                </div>
                安全生产分管责任人
              </div>
              <div class="new-List-box-name">
                <el-form-item
                  hide-required-asterisk="true"
                  :rules="{
                    required: true,
                    message: '请输入安全生产分管责任人姓名不能为空',
                    trigger: 'blur',
                  }"
                  label=""
                  prop="depHead"
                >
                  <el-input
                    style="width: 380px"
                    placeholder="请输入安全生产分管责任人姓名"
                    v-model="numberValidateForm.depHead"
                    v-if="isEdit"
                  >
                  </el-input>
                  <div v-else>
                    {{ numberValidateForm.depHead }}
                  </div>
                </el-form-item>
              </div>
              <div class="new-List-box-title">
                <div style="color: #ff6a6b; font-size: 16px; font-family: MicrosoftYaHei">
                  *
                </div>
                职务
              </div>
              <div class="new-List-box-name">
                <el-form-item
                  hide-required-asterisk="true"
                  :rules="[
                    {
                      required: true,
                      message: '请输入负责人职务',
                      trigger: 'blur',
                    },
                  ]"
                  label=""
                  prop="depJob"
                >
                  <el-input
                    v-if="isEdit"
                    style="width: 380px"
                    placeholder="请输入负责人职务"
                    v-model="numberValidateForm.depJob"
                  ></el-input>
                  <div v-else>
                    {{ numberValidateForm.depJob }}
                  </div>
                </el-form-item>
              </div>
              <div class="new-List-box-title">
                <div style="color: #ff6a6b; font-size: 16px; font-family: MicrosoftYaHei">
                  *
                </div>
                负责人电话
              </div>
              <div class="new-List-box-name">
                <el-form-item
                  hide-required-asterisk="true"
                  :rules="[
                    {
                      required: true,
                      message: '负责人电话',
                      trigger: 'blur',
                    },
                    {
                      min: 11,
                      max: 11,
                      message: '请输入11位手机号',
                      trigger: 'blur',
                    },
                  ]"
                  label=""
                  prop="depHeadPhone"
                >
                  <el-input
                    v-if="isEdit"
                    style="width: 380px"
                    placeholder="请输入负责人电话"
                    v-model="numberValidateForm.depHeadPhone"
                  ></el-input>
                  <div v-else>
                    {{ numberValidateForm.depHeadPhone }}
                  </div>
                </el-form-item>
              </div>
            </div>
            <div class="new-List-box">
              <div class="new-List-box-title">
                <div style="color: #ff6a6b; font-size: 16px; font-family: MicrosoftYaHei">
                  *
                </div>
                安全内设机构责任人
              </div>
              <div class="new-List-box-name">
                <el-form-item
                  hide-required-asterisk="true"
                  :rules="{
                    required: true,
                    message: '请输入安全内设机构责任人姓名不能为空',
                    trigger: 'blur',
                  }"
                  label=""
                  prop="orgHead"
                >
                  <el-input
                    style="width: 380px"
                    placeholder="请输入安全内设机构责任人姓名"
                    v-model="numberValidateForm.orgHead"
                    v-if="isEdit"
                  >
                  </el-input>
                  <div v-else>
                    {{ numberValidateForm.orgHead }}
                  </div>
                </el-form-item>
              </div>
              <div class="new-List-box-title">
                <div style="color: #ff6a6b; font-size: 16px; font-family: MicrosoftYaHei">
                  *
                </div>
                职务
              </div>
              <div class="new-List-box-name">
                <el-form-item
                  hide-required-asterisk="true"
                  :rules="[
                    {
                      required: true,
                      message: '请输入负责人职务',
                      trigger: 'blur',
                    },
                  ]"
                  label=""
                  prop="orgJob"
                >
                  <el-input
                    v-if="isEdit"
                    style="width: 380px"
                    placeholder="请输入负责人职务"
                    v-model="numberValidateForm.orgJob"
                  ></el-input>
                  <div v-else>
                    {{ numberValidateForm.orgJob }}
                  </div>
                </el-form-item>
              </div>
              <div class="new-List-box-title">
                <div style="color: #ff6a6b; font-size: 16px; font-family: MicrosoftYaHei">
                  *
                </div>
                负责人电话
              </div>
              <div class="new-List-box-name">
                <el-form-item
                  hide-required-asterisk="true"
                  :rules="[
                    {
                      required: true,
                      message: '负责人电话',
                      trigger: 'blur',
                    },
                    {
                      min: 11,
                      max: 11,
                      message: '请输入11位手机号',
                      trigger: 'blur',
                    },
                  ]"
                  label=""
                  prop="orgHeadPhone"
                >
                  <el-input
                    v-if="isEdit"
                    style="width: 380px"
                    placeholder="请输入负责人电话"
                    v-model="numberValidateForm.orgHeadPhone"
                  ></el-input>
                  <div v-else>
                    {{ numberValidateForm.orgHeadPhone }}
                  </div>
                </el-form-item>
              </div>
            </div>
            <div v-if="secondTypeCode == '15130200'">
              <div class="new-List-box">
                <div class="new-List-box-title">
                  <div
                    style="color: #ff6a6b; font-size: 16px; font-family: MicrosoftYaHei"
                  >
                    *
                  </div>
                  总床位数
                </div>
                <div class="new-List-box-name">
                  <el-form-item
                    label=""
                    prop="countBedNum"
                    hide-required-asterisk="true"
                    :rules="[
                      {
                        required: true,
                        message: '请输入总床位数',
                        trigger: 'blur',
                      },
                    ]"
                  >
                    <el-input
                      type="number"
                      v-if="isEdit"
                      placeholder="请输入总床位数"
                      v-model="numberValidateForm.countBedNum"
                      style="width: 380px"
                    ></el-input>
                    <div v-if="!isEdit">
                      {{ numberValidateForm.countBedNum }}
                    </div>
                  </el-form-item>
                </div>
                <div class="new-List-box-title">
                  <div
                    style="color: #ff6a6b; font-size: 16px; font-family: MicrosoftYaHei"
                  >
                    *
                  </div>
                  占用床位数
                </div>
                <div class="new-List-box-name">
                  <el-form-item
                    label=""
                    prop="useBedNum"
                    hide-required-asterisk="true"
                    :rules="[
                      {
                        required: true,
                        message: '请输入占用床位数',
                        trigger: 'blur',
                      },
                    ]"
                  >
                    <el-input
                      type="number"
                      v-if="isEdit"
                      placeholder="请输入占用床位数"
                      v-model="numberValidateForm.useBedNum"
                      style="width: 380px"
                    ></el-input>
                    <div v-if="!isEdit">
                      {{ numberValidateForm.useBedNum }}
                    </div>
                  </el-form-item>
                </div>
                <div class="new-List-box-title">
                  <div
                    style="color: #ff6a6b; font-size: 16px; font-family: MicrosoftYaHei"
                  >
                    *
                  </div>
                  空床位数
                </div>
                <div class="new-List-box-name">
                  <el-form-item
                    label=""
                    prop="idleBedNum"
                    hide-required-asterisk="true"
                    :rules="[
                      {
                        required: true,
                        message: '请输入空床位数',
                        trigger: 'blur',
                      },
                    ]"
                  >
                    <el-input
                      type="number"
                      v-if="isEdit"
                      placeholder="请输入空床位数"
                      v-model="numberValidateForm.idleBedNum"
                      style="width: 380px"
                    ></el-input>
                    <div v-if="!isEdit">
                      {{ numberValidateForm.idleBedNum }}
                    </div>
                  </el-form-item>
                </div>
              </div>
              <div class="new-List-box">
                <div class="new-List-box-title">
                  <div
                    style="color: #ff6a6b; font-size: 16px; font-family: MicrosoftYaHei"
                  >
                    *
                  </div>
                  {{ diyitishiyu }}
                </div>
                <div class="new-List-box-name">
                  <el-form-item
                    hide-required-asterisk="true"
                    :rules="{
                      required: true,
                      message: `请输入${diyitishiyu}`,
                      trigger: 'blur',
                    }"
                    label=""
                    prop="peopleNum1"
                    v-if="isYi"
                  >
                    <el-input
                      type="number"
                      style="width: 380px"
                      :placeholder="'请输入' + diyitishiyu"
                      v-model="numberValidateForm.peopleNum1"
                      v-if="isEdit"
                    ></el-input>
                    <div v-if="!isEdit">
                      {{ numberValidateForm?.peopleNum1 }}
                    </div>
                  </el-form-item>
                </div>
                <div class="new-List-box-title">
                  <div
                    style="color: #ff6a6b; font-size: 16px; font-family: MicrosoftYaHei"
                  >
                    *
                  </div>
                  {{ diertishiyu }}
                </div>
                <div class="new-List-box-name" style="width: 1028px">
                  <el-form-item
                    hide-required-asterisk="true"
                    :rules="{
                      required: true,
                      message: `请输入${diertishiyu}`,
                      trigger: 'blur',
                    }"
                    label=""
                    prop="peopleNum2"
                    v-if="isEr"
                  >
                    <el-input
                      type="number"
                      style="width: 944px"
                      :placeholder="'请输入' + diertishiyu"
                      v-model="numberValidateForm.peopleNum2"
                      v-if="isEdit"
                    ></el-input>
                    <div v-if="!isEdit">
                      {{ numberValidateForm?.peopleNum2 }}
                    </div>
                  </el-form-item>
                </div>
              </div>
            </div>
            <div v-else>
              <div class="new-List-box" v-if="!isEr&&isYi">
                <div class="new-List-box-title">
                  <div
                    style="color: #ff6a6b; font-size: 16px; font-family: MicrosoftYaHei"
                  >
                    *
                  </div>
                  {{ diyitishiyu }}
                </div>
                <div class="new-List-box-name" style="width: 1650px">
                  <el-form-item
                    hide-required-asterisk="true"
                    :rules="{
                      required: true,
                      message: `请输入${diyitishiyu}`,
                      trigger: 'blur',
                    }"
                    label=""
                    prop="peopleNum1"
                    v-if="isYi"
                  >
                    <el-input
                      type="number"
                      style="width: 1520px"
                      :placeholder="'请输入' + diyitishiyu"
                      v-model="numberValidateForm.peopleNum1"
                      v-if="isEdit"
                    ></el-input>
                    <div v-if="!isEdit">
                      {{ numberValidateForm?.peopleNum1 }}
                    </div>
                  </el-form-item>
                </div>
              </div>
              <div class="new-List-box" v-if="isYi==true && isEr==true">
                
                <div class="new-List-box-title">
                  <div
                    style="color: #ff6a6b; font-size: 16px; font-family: MicrosoftYaHei"
                  >
                    *
                  </div>
                  {{ diyitishiyu }}
                </div>
                <div class="new-List-box-name">
                  <el-form-item
                    hide-required-asterisk="true"
                    :rules="{
                      required: true,
                      message: `请输入${diyitishiyu}`,
                      trigger: 'blur',
                    }"
                    label=""
                    prop="peopleNum1"
                    v-if="isYi"
                  >
                    <el-input
                      type="number"
                      style="width: 380px"
                      :placeholder="'请输入' + diyitishiyu"
                      v-model="numberValidateForm.peopleNum1"
                      v-if="isEdit"
                    ></el-input>
                    <div v-if="!isEdit">
                      {{ numberValidateForm?.peopleNum1 }}
                    </div>
                  </el-form-item>
                </div>
                <div class="new-List-box-title">
                  <div
                    style="color: #ff6a6b; font-size: 16px; font-family: MicrosoftYaHei"
                  >
                    *
                  </div>
                  {{ diertishiyu }}
                </div>

                <div class="new-List-box-name" style="width: 1028px">
                  <el-form-item
                    hide-required-asterisk="true"
                    :rules="{
                      required: true,
                      message: `请输入${diertishiyu}`,
                      trigger: 'blur',
                    }"
                    label=""
                    prop="peopleNum2"
                    v-if="isEr"
                  >
                    <el-input
                      type="number"
                      style="width: 994px"
                      :placeholder="'请输入' + diertishiyu"
                      v-model="numberValidateForm.peopleNum2"
                      v-if="isEdit"
                    ></el-input>
                    <div v-if="!isEdit">
                      {{ numberValidateForm?.peopleNum2 }}
                    </div>
                  </el-form-item>
                </div>
              </div>
            </div>
            <div class="new-List-box" style="height: auto">
              <div class="new-List-box-title" style="height: 116px; line-height: 116px">
                <div style="color: #ff6a6b; font-size: 16px; font-family: MicrosoftYaHei">
                  *
                </div>
                防护目标概况
              </div>
              <div class="new-List-box-name" style="width: 1650px; height: 116px">
                <el-form-item label="" prop="dsc" style="text-align: right">
                  <el-input
                    style="width: 1610px; text-indent: 2em; height: 100px"
                    v-if="isEdit"
                    type="textarea"
                    placeholder="请输入队伍概况"
                    v-model="numberValidateForm.dsc"
                    maxlength="1000"
                    show-word-limit
                    :autosize="{ minRows: 4, maxRows: 4 }"
                  >
                  </el-input>
                  <div
                    v-if="!isEdit"
                    style="
                      overflow: auto;
                      height: 116px;
                      text-indent: 2em;
                      text-align: left;
                    "
                  >
                    {{ numberValidateForm?.dsc }}
                  </div>
                </el-form-item>
              </div>
            </div>
            <div style="height: 50px"></div>
            <div
              style="
                width: 100%;
                display: flex;
                justify-content: center;
                align-items: center;
              "
              v-if="$route.query.depId"
            >
              <el-button size="mini" type="danger" @click="Back" class="table-cancel-btn"
                >返回
              </el-button>
            </div>
            <div
              v-else
              style="
                width: 100%;
                display: flex;
                justify-content: center;
                align-items: center;
              "
            >
              <el-button
                @click="bianji"
                v-if="!isEdit"
                style="
                  border: 1px solid #38c2c6;
                  background: #38c2c6;
                  border-radius: 4px;
                  font-size: 16px;
                  font-family: MicrosoftYaHei;
                  color: rgba(255, 255, 255, 0.9);
                "
                >编辑</el-button
              >
              <el-button
                size="mini"
                type="danger"
                v-if="isEdit"
                @click="Back"
                class="table-cancel-btn"
                >返回
              </el-button>
              <el-button
                v-if="isEdit"
                type="primary"
                @click="submitForm('numberValidateForm')"
                style="
                  border: 1px solid #38c2c6;
                  background: #38c2c6;
                  border-radius: 4px;
                  font-size: 16px;
                  font-family: MicrosoftYaHei;
                  color: rgba(255, 255, 255, 0.9);
                "
                >保存</el-button
              >
            </div>
          </el-form>
        </div>
      </div>
      <!-- </template> -->
    </borderomponent>
  </div>
</template>

<script>
import addPersonnelTree from "@/components/addPersonnelTree/index.vue";
import borderomponent from "@/components/borderomponent/index.vue";
import dialogXinzengchengyuan from "@/components/dialog-xinzengchengyuan.vue";
import selectPersonPopup from "@/components/selectPersonPopup/index.vue";
import {
  protectTargetGetByDepId,
  protectTargetSaveOrUpdate,
  organizationListTree,
  orgDetail,
  idaasFindUsersByDepId,
} from "@/api/resourceManagement/index.js";
import NewMap from "@/components/egis-map/map.vue";
const validPhone = (rule, value, callback) => {
  if (!value) {
    callback(new Error("请输入手机号码"));
  } else if (value.lenght < 11) {
    //判断用户输入的值是否符合规则
    callback(new Error("请输入11位手机号码"));
  }
};
export default {
  name: "protectionTargetAdministrator",
  components: {
    borderomponent,
    addPersonnelTree,
    selectPersonPopup,
    NewMap,
    dialogXinzengchengyuan,
  },

  data() {
    return {
      yiyuan: false,
      reloaded: false,
      isEdit: false,
      isOuterVisible: false,
      Newaddress: {
        address: "",
        coordinateX: "",
        coordinateY: "",
      },
      isxinyong: true,
      isYi: true,
      isEr: true,
      diyitishiyu: "",
      diertishiyu: "",
      department: "xxx",
      isDialogVisible: 0,
      renyuan: "",
      renyuanType: "",
      dialogVisible: false,
      filterText: "",
      renyuanfilterText: "",
      data: [],
      renyaundata: [],
      defaultProps: {
        children: "children",
        label: "label",
      },
      newDialogVisible: false,
      ProtectiveTargetsArray: [
        { name: "学校（大中小学、公立幼儿园）", value: "1" },
        { name: "医院", value: "2" },
        { name: "商超（ 年交易额亿元以上）", value: "3" },
        { name: "公立养老院", value: "4" },
        { name: "公立儿童福利院", value: "5" },
        { name: "体育场馆（座位数500或以上）", value: "6" },
        { name: "旅游景区（3A级或以上）", value: "7" },
        { name: "火车站", value: "8" },
        { name: "客运站", value: "9" },
        { name: "公交公司", value: "10" },
        { name: "高危企业", value: "11" },
        { name: "森林草原火险重点防范单位", value: "12" },
      ],
      ProtectiveTargetsIndex: "1",
      numberValidateForm: {
        id: "",
        depId: "", //部门id，暂时自填
        protectName: "", //防护目标名称
        protectType: "", //防护目标类型
        cid: "", //社会统一信用代码
        address: "", //驻地位置
        coordinateX: "", //x坐标
        coordinateY: "", //y坐标
        firstHead: "", //第一负责人
        depHead: "", //分管负责人
        orgHead: "", //机构负责人
        peopleNum1: "", //人数1
        peopleNum2: "", //人数2
        area: "", //面积
        dsc: "", //备注
      },
    };
  },
  created() {},
  mounted() {
    console.log(this.$userInfo);
    // if (location.href.indexOf("#reloaded") == -1) {
    //   location.href = location.href + "#reloaded";
    //   location.reload();
    // }
    this.protectTargetGetByDepId();
  },
  watch: {
    filterText(val) {
      this.$refs.tree.filter(val);
    },
    renyuanfilterText(val) {
      this.$refs.newtree.filter(val);
    },
    // $route: {
    //   // $route可以用引号，也可以不用引号  监听的对象
    //   handler (to, from) {
    //     console.log('路由变化了')
    //     console.log('当前页面路由：' + to)
    //     console.log('上一个路由：' + from)

    //   },
    //   deep: true, // 深度观察监听 设置为 true
    //   immediate: true // 第一次初始化渲染就可以监听到
    // }
  },
  methods: {
    Back() {
      if (this.$route.query.depId) {
        this.$router.go(-1);
      } else {
        this.protectTargetGetByDepId();
      }
      this.isEdit = false;
    },
    bianji() {
      this.isEdit = true;
    },
    getAddress(e) {
      this.numberValidateForm.address = e;
    },
    clsoe() {
      this.isOuterVisible = false;
    },
    // 开启成员选择
    tianjia(e, isTrue) {
      this.renyuanType = e;
      this.isOuterVisible = isTrue;

      console.log(this.isOuterVisible);
    },
    // 新增成员
    addMembers() {
      this.isOuterVisible = false;
      this.isDialogVisible = true;
    },
    // 获取负责人
    getHeadName(e) {
      this.isOuterVisible = false;
      if (e == "") return;
      console.log(e.displayName);
      // this.$set(this.numberValidateForm, 'headName', e.displayName)
      // console.log(e.displayName, this.numberValidateForm.headName)
      if (this.renyuanType == 1) {
        this.numberValidateForm.firstHead = e.displayName;
        this.numberValidateForm.firstHeadPhone = e.phoneNum;
        this.numberValidateForm.firstHeadId = e.id;
      } else if (this.renyuanType == 2) {
        this.numberValidateForm.depHead = e.displayName;
        this.numberValidateForm.depHeadPhone = e.phoneNum;
        this.numberValidateForm.depHeadId = e.id;
      } else if (this.renyuanType == 3) {
        this.numberValidateForm.orgHead = e.displayName;
        this.numberValidateForm.orgHeadPhone = e.phoneNum;
        this.numberValidateForm.orgHeadId = e.id;
      }
    },
    childValue(e) {
      console.log(e,'地址123');
      this.Newaddress = e;
      this.Newaddress.address = this.numberValidateForm.address;
      // this.numberValidateForm.address = e.address
      this.numberValidateForm.coordinateX = e.latitude;
      this.numberValidateForm.coordinateY = e.longitude;
      console.log(this.numberValidateForm);
    },
    getName(e) {
      this.filterText = "";
      this.renyuanfilterText = "";
      if (e == 1) {
        this.dialogVisible = false;
      } else {
        if (this.renyuanType == 1) {
          this.$set(this.numberValidateForm, "firstHeadPhone", e.phone);
          this.$set(this.numberValidateForm, "firstHead", e.name);
          this.$set(this.numberValidateForm, "firstHeadId", e.id);
        } else if (this.renyuanType == 2) {
          this.$set(this.numberValidateForm, "depHead", e.name);
          this.$set(this.numberValidateForm, "depHeadPhone", e.phone);
          this.$set(this.numberValidateForm, "depHeadId", e.id);
        } else if (this.renyuanType == 3) {
          this.$set(this.numberValidateForm, "orgHead", e.name);
          this.$set(this.numberValidateForm, "orgHeadPhone", e.phone);
          this.$set(this.numberValidateForm, "orgHeadId", e.id);
        }
        console.log(e);
        this.dialogVisible = false;
      }
    },
    jianting(e) {
      this.isDialogVisible = 0;
    },
    xinzeng() {
      console.log("新增成员");
      this.isDialogVisible = 1;
      this.dialogVisible = false;
    },
    handleClose() {
      this.dialogVisible = false;
      console.log(12234, this.dialogVisible);
      this.$forceUpdate();
    },
    newdialogVisible(e) {
      console.log(e);
      this.filterText = "";
      this.renyuanfilterText = "";
      if (e == 1) {
        this.dialogVisible = false;
      } else {
        if (this.renyuanType == 1) {
          this.numberValidateForm.firstHead = this.renyuan;
        } else if (this.renyuanType == 2) {
          this.numberValidateForm.depHead = this.renyuan;
        } else if (this.renyuanType == 3) {
          this.numberValidateForm.orgHead = this.renyuan;
        }
        console.log(e);
        this.dialogVisible = false;
      }
    },
    filterNode(value, data) {
      console.log(data);
      if (!value) return true;
      return data.label.indexOf(value) !== -1;
    },
    handleNodeClick(data) {
      console.log(data);
      if (data.children.length == 0) {
        idaasFindUsersByDepId({ depId: data.id }).then((res) => {
          console.log(res);
          this.renyaundata = JSON.parse(
            JSON.stringify(res.data).replace(/name/g, "label")
          );
        });
      }
    },
    renyuanHandleNodeClick(data) {
      console.log(data.label);
      this.renyuan = data.label;
    },
    //
    protectTargetGetByDepId() {
      let data = {
        depId: this.$route.query.depId ? this.$route.query.depId : this.$userInfo.orgId,
      };
      protectTargetGetByDepId(data).then((res) => {
        this.secondTypeCode = res.data?.secondTypeCode;
        if (
          res.data?.secondTypeCode == "15130100" ||
          res.data?.secondTypeCode == "15130101" ||
          res.data?.secondTypeCode == "15130102" ||
          res.data?.secondTypeCode == "15130103" ||
          res.data?.secondTypeCode == "15130104"
        ) {
          //学校
          this.isxinyong = true;
          this.diyitishiyu = "教职工人数";
          this.diertishiyu = "年平均在校学生人数";
        } else if (res.data?.secondTypeCode == "15130200") {
          //医院
          this.diyitishiyu = "在岗职工人数";
          this.diertishiyu = "日均诊疗人数";
          this.yiyuan = true;
        } else if (res.data?.secondTypeCode == "15130300") {
          //商超
          this.diyitishiyu = "年末从业人数";
          this.diertishiyu = "日最大流量";
        } else if (
          //养老院儿童福利院
          res.data?.secondTypeCode == "15130400" ||
          res.data?.secondTypeCode == "15130500"
        ) {
          this.diyitishiyu = "在岗职工人数";
          this.diertishiyu = "年平均在院人数";
        } else if (res.data?.secondTypeCode == "15130700") {
          //旅游景区
          this.diyitishiyu = "在岗职工人数";
          this.diertishiyu = "日最大承载客流人数";
        } else if (
          res.data?.secondTypeCode == "15130800" ||
          res.data?.secondTypeCode == "15130900"
        ) {
          //火车站客运站
          this.diyitishiyu = "日均客流数量";
          this.isEr = false;
        } else if (res.data?.secondTypeCode == "15131000") {
          //公交公司
          this.isYi = false;
          this.isEr = false;
        } else if (res.data?.secondTypeCode == "15131500") {
          //高危企业
          this.isYi = false;
          this.isEr = false;
        } else if (res.data?.secondTypeCode == "15131200") {
          //森林草原火险重点防范单位
          this.isEr = false;
          this.diyitishiyu = "面积（m2）";
        } else if (res.data?.secondTypeCode == "15130600") {
          //体育馆
          this.diyitishiyu = "在岗职工人数";
          // this.diertishiyu = "平均每周接待人次";
          this.isEr = false;
        } else if (res.data?.secondTypeCode == "15131400") {
          //加油站
          this.isYi = true;
          this.isEr = false;
          this.diyitishiyu = "在岗职工人数";
        } else if (res.data?.secondTypeCode == "15131100") {
          //重点水利
          this.isYi = true;
          this.isEr = false;
          this.diyitishiyu = "坝高(米)";
        } else {
          this.isYi = false;
          this.isEr = false;
        }
        this.numberValidateForm = res.data;
        console.log(this.Newaddress);
        this.Newaddress.address = res.data?.address;
        this.Newaddress.coordinateX = res.data?.coordinateX;
        this.Newaddress.coordinateY = res.data?.coordinateY;
      });
    },
    submitForm(formName) {
      if (
        this.numberValidateForm.coordinateX == "" ||
        this.numberValidateForm.coordinateY == ""
      ) {
        this.$message({
          message: "请选择经纬度",
          type: "warning",
        });
        return;
      }
      this.$refs[formName].validate((valid) => {
        if (valid) {
          console.log(this.$userInfo.createdBy, "信息");
          this.numberValidateForm.depId = this.$userInfo.orgId;
          this.numberValidateForm.createdBy = this.$userInfo.createdBy;
          let data = this.numberValidateForm;
          protectTargetSaveOrUpdate(data).then((res) => {
            console.log(res, "保存成功");

            if (res && res.code == 0) {
              this.isEdit = false;
              this.$message.success("保存成功");
            } else {
              this.$message.error("服务端返回数据异常");
            }
          });
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.bigBox {
  width: 100%;
  height: 100%;
  position: relative;
  .bigBox-box {
    padding: 20px;
    .bigBox-box-tab {
      margin-top: 20px;
      .bigBox-box-tab-item {
        width: 100%;
        height: 32px;
        display: flex;
        margin-bottom: 25px;
        justify-content: space-between;
        align-items: center;
        // margin-right: 100px;
        .el-form-item__label {
          font-size: 16px;
          font-family: MicrosoftYaHei;
          color: #cbe7ff !important;
        }
        .el-input-group__append,
        .el-input-group__prepend {
          background: rgba(124, 173, 216, 0.2) !important;
          border-radius: 0px 4px 4px 0px !important;
          border: 1px solid #7cadd8 !important;
          color: #ffffff;
        }
        .el-form-item {
          // display: flex;
          // align-items: center;
          // width: 40%;
          margin: 0;
        }
        .el-form-item__content {
        }
        .bigBox-box-tab-item-xq {
          text-align: left;
          width: 280px;
          font-size: 16px;
          font-family: MicrosoftYaHei;
          color: #ffffff;
        }
        .append-box {
          display: flex;
          height: 28px;
          justify-content: flex-start;
          align-items: center;
          font-size: 16px;
          cursor: pointer;
        }
        .append-img {
          width: 14px;
          height: 14px;
          margin-left: 10px;
        }
      }
      .bigBox-box-tab-item {
        // width: 100%;
        // height: 32px;
        // display: flex;
        margin-bottom: 25px;
        // justify-content: space-between;
        // align-items: center;
        // margin-right: 100px;
        .el-form-item__label {
          font-size: 16px;
          font-family: MicrosoftYaHei;
          color: #cbe7ff !important;
        }
        .el-form-item {
          // display: flex;
          // align-items: center;
          margin: 0;
        }
        .el-input-group__append,
        .el-input-group__prepend {
          height: 28px;
          background: rgba(124, 173, 216, 0.2) !important;
          border-radius: 0px 4px 4px 0px !important;
          border: 1px solid #7cadd8 !important;
          color: #ffffff;
        }

        .bigBox-box-tab-item-xq {
          text-align: left;
          font-size: 16px;
          font-family: MicrosoftYaHei;
          color: #ffffff;
        }
        .append-box {
          display: flex;
          justify-content: flex-start;
          align-items: center;
          font-size: 16px;
          cursor: pointer;
          height: 28px;
        }
        .append-img {
          width: 14px;
          height: 14px;
          margin-left: 10px;
        }
        .weizhi {
          background: url("~@/assets/TeamAdministrator/location.png") no-repeat;
        }
        .renyuan {
          background: url("~@/assets/TeamAdministrator/input_box-contacts.png") no-repeat !important;
        }
      }
    }
  }
}

.el-tree {
  width: 100%;
  background-color: transparent;
  color: rgba(255, 255, 255, 0.9);
}
// 重置dialog样式
.el-dialog {
  background: transparent;
  //   box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.1);
  //   border-radius: 4px;

  .el-dialog__header {
    background: rgba(6, 50, 88, 0.9);
    padding: 20px 0 0 20px;
    height: 24px;
    line-height: 24px;
  }

  .el-dialog__title {
    // color: #313335;
    color: #ffffff;
    font-size: 16px;
    font-weight: bold;
  }

  .el-dialog__headerbtn {
    top: 20px;
    right: 20px;
    height: 14px;
    line-height: 14px;

    .el-dialog__close {
      // color: #354052;
      color: #4af6fc;
      width: 14px;
      height: 14px;
    }
  }

  .el-dialog__body {
    width: calc(100% - 40px);
    padding: 30px 20px 20px;
    // font-size: 0.16px;
    font-size: 0.18px;
    color: #313335;
    background: rgba(6, 50, 88, 0.9);
  }
  .el-dialog__footer {
    background: rgba(6, 50, 88, 0.9) !important;
  }
}
.el-tree-node:focus > .el-tree-node__content {
  background: rgba(74, 246, 252, 0.1);
  box-shadow: inset 0px 0px 10px 0px #4af6fc;
}
.el-tree-node__content:hover {
  background: rgba(74, 246, 252, 0.1);
}
.el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content {
  background: rgba(74, 246, 252, 0.1);
  box-shadow: inset 0px 0px 10px 0px #4af6fc;
}
.xuanzechengyuanBox {
  display: flex;
  justify-content: space-between;
}
.tianjiachengyuan {
  margin-bottom: 15px;
  color: #4af6fc;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  cursor: pointer;
}
.chengyuanImg {
  width: 14px;
  height: 14px;
  background: url("~@/assets/TeamAdministrator/icon_add.png");
  margin-right: 8px;
}
.title {
  margin-bottom: 15px;
  color: #fff;
}
.el-tree-node__content > .el-tree-node__expand-icon {
  position: absolute;
  opacity: 0;
}

.el-tree-node__content {
  position: relative;
}
.chengyuanxiangqing {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  background: url("~@/assets/TeamAdministrator/icon_folder_shut(3).png");
}
.zhedie {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  background: url("~@/assets/TeamAdministrator/icon_folder_shut(2).png");
}
.zhankai {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  background: url("~@/assets/TeamAdministrator/icon_folder_shut(1).png");
}
.geren {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  background: url("~@/assets/TeamAdministrator/icon_folder_shut.png");
}
.dialogBox-box-right {
  border-left: 1px solid #1d5a8f;
  padding-left: 8px;
}
.dialogBox-box-left {
  padding-right: 8px;
}
.el-tree > .el-tree-node {
  display: inline-block;
  min-width: 100%;
}
.el-input.is-disabled .el-input__inner {
  width: 320px;
  height: 32px;
}
input {
  height: 32px;
}
::v-deep textarea {
  height: 260px; /* 固定高度 */
  width: 100%; /* 宽度百分比 */
  resize: none;
  background: transparent; //  背景透明
  border: 1px solid #7cadd8;
}
::v-deep .el-textarea__inner {
  background: transparent !important; //  背景透明
  border: 1px solid #7cadd8 !important;
  color: #fff !important;
}
::v-deep .el-input__count {
  background-color: transparent;
  color: #7cadd8;
}
.bigBox-box-tab-item-xq {
  text-align: left !important;
}
.newBox-title {
  width: 1836px;
  height: 60px;
  font-size: 24px;
  font-family: MicrosoftYaHei-Bold, MicrosoftYaHei;
  font-weight: bold;
  color: #4af6fc;
  text-align: center;
  line-height: 60px;
  background: linear-gradient(
    90deg,
    rgba(51, 153, 255, 0) 0%,
    rgba(0, 160, 255, 0.26) 50%,
    rgba(51, 153, 255, 0) 100%
  );
}
.new-List-box {
  width: 1836px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  .new-List-box-title {
    width: 160px;
    height: 48px;
    display: flex;
    justify-content: flex-start;
    padding-left: 20px;
    font-size: 16px;
    font-family: MicrosoftYaHei;
    color: #cbe7ff;
    line-height: 48px;
    background: rgba(0, 153, 255, 0.2);
    border: 1px solid rgba(0, 153, 255, 0.2);
  }
  .new-List-box-name {
    width: 412px;
    height: 48px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    font-size: 16px;
    padding-left: 20px;
    font-family: MicrosoftYaHei;
    line-height: 48px;
    color: #ffffff;
    background: rgba(0, 153, 255, 0.06);
    border: 1px solid rgba(0, 153, 255, 0.2);
  }
}
.el-form-item {
  margin-bottom: 0 !important;
}
// .lianghangchang {
//   width: 1044px;
// }
.el-input.is-disabled .el-input__inner {
  height: 32px !important;
}
</style>
